import { MiddlewareConsumer, Module, RequestMethod } from "@nestjs/common";
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
import { CoreModule } from "./core/core.module";
import { LoggerService } from "./logger.service";
import { OtherModule } from "./other/other.module";
import { DynamicModule } from "./dynamic.module";
import { NestMiddleware } from "@nestjs/common";
import { Request, Response, NextFunction } from "express";
import { NestModule } from "@nestjs/common";
import { LoggerMiddleware } from "./Logger.middleware";

@Module({
  imports: [DynamicModule.forRoot(), OtherModule, CoreModule],
  controllers: [AppController],
  providers: [AppService, LoggerService],
})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(LoggerMiddleware).forRoutes({ path: "app/aaaa", method: RequestMethod.GET });
  }
}
